package parser;
/**
 * 
 * @author ron,bar,yuval
 * class LexicalError for reporting detailed
 * 		 lexical errors while scanning the IC text file
 * 
 *
 */
@SuppressWarnings("serial")
public class LexicalError extends Exception
{
	String newMessage;
	int line;
    public LexicalError(String message){
    	super(message);
    	this.newMessage =message;
    	this.line = -1;
    }
    /**
     * constructor
     * @param message string which will be printed
     * @param line number of the line in which error occurred
     */	
    public LexicalError(String message, int line){
    	this(message);
    	this.line = ++line;
    }
    /**
     * defines the format of a printed LexicalError
     */	
    public String toString(){
    	return this.line + ": " +"Lexical Error:" +  this.newMessage;
    }

}

